const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');

const Student = sequelize.define('student', {
  name: { type: DataTypes.STRING, allowNull: false },
  student_no: { type: DataTypes.STRING, allowNull: false, unique: true },
  gender: { type: DataTypes.STRING, defaultValue: '保密' },
  id_card: { type: DataTypes.STRING, allowNull: false, unique: true },
  password: { type: DataTypes.STRING, allowNull: false },
  points: { type: DataTypes.INTEGER, defaultValue: 0 }
}, {
  tableName: 'students',
  timestamps: false
});
sequelize.sync({ force: false }); // 禁止强制同步，避免删除数据

module.exports = Student;
